package com.jinke.api.modules.api.conf;

import com.jinke.api.modules.api.interceptor.ApiInterceptor;
import com.jinke.api.security.config.IgnoreUrlsConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ApiConfig implements WebMvcConfigurer {
    private final ApiInterceptor customInterceptor;

    @Autowired
    public ApiConfig(ApiInterceptor customInterceptor) {
        this.customInterceptor = customInterceptor;
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(customInterceptor)
                .addPathPatterns("/api/**"); // 指定拦截的路径
    }
//    @Bean
//    public IgnoreUrlsConfig ApiIgnoreUrlsConfig() {
//        return new IgnoreUrlsConfig();
//    }

}
